home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / do1beta.zip / CREATE.DO < prev    next >
Text File  |  1991-07-24  |  702b  |  28 lines

  1. /*
  2.     this is an example of how to create a .DBF file
  3.     the argument to "createDbf" is an array of arrays
  4.     of field defintions. each field definition array
  5.     contains a string that is the DBASE field name,
  6.     a character field type ('C' = char, 'N' = numeric, 'D' = date),
  7.     an integer length, and an integer number of decimals for numerics 
  8. */
  9. db = createDbf("test",[
  10.     ["cfield",'C',32,0],
  11.     ["nfield",'N',5,0],
  12.     ["dfield",'D',0,0],
  13.     ["mfield",'M',1024,0]]);
  14.  
  15. i = 1;
  16. while(i < 10) {
  17.     nfield = i;
  18.     cfield = "test"+asString(i);
  19.     dfield = date();
  20.     mfield = "memo" + asString(i);
  21.     res = write(db,0L);
  22.     i = i+1;
  23. }
  24.  
  25. ? "table TEST.DBF created";
  26. ? "structure is ",structure(db);
  27. close(db);
  28.